﻿using Gym.Application.Common.Interfaces;
using Gym.Domain.GymAggregate.Events;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gym.Application.Rooms.Events
{
    public class RoomAddedEventHandler : INotificationHandler<RoomAddedEvent>
    {
        private readonly IRoomsRepository _roomsRepository;

        public RoomAddedEventHandler(IRoomsRepository roomsRepository)
        {
            _roomsRepository = roomsRepository;
        }

        public async Task Handle(RoomAddedEvent notification, CancellationToken cancellationToken)
        {
            await _roomsRepository.AddRoomAsync(notification.Room);
        }
    }
}
